package com.dreamchaser.depository_manage.common;

import lombok.Data;

import java.io.Serializable;

/**
 * 返回类
 * @author yancy0109
 */

@Data
public class BaseResponse <T> implements Serializable {

    /**
     * 状态码
     */
    private int code;

    /**
     * 返回data
     */
    private T data;

    /**
     * 错误信息
     */
    private String message;

    public BaseResponse(int code, T data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }

    public BaseResponse(int code, T data){
        this(code, data, "");
    }

    public BaseResponse(ErrorCode errorCode){
        this(errorCode.getCode(), null, errorCode.getMessage());
    }
}
